from fastapi import APIRouter, Depends, HTTPException, status
from pydantic import BaseModel
from typing import Optional

router = APIRouter()


class UserRegister(BaseModel):
    username: str
    email: str
    password: str


class UserLogin(BaseModel):
    username: str
    password: str


@router.post("/register", summary="用户注册")
async def register_user(user_data: UserRegister):
    """
    2.1: 用户注册功能
    """
    # TODO: Implement actual user registration logic
    return {"message": "用户注册成功", "username": user_data.username}


@router.post("/login", summary="用户登录")
async def login_user(user_data: UserLogin):
    """
    2.2: 用户登录功能
    """
    # TODO: Implement actual user authentication logic
    return {"message": "登录成功", "token": "sample_token", "username": user_data.username}


@router.get("/me", summary="获取当前用户信息")
async def get_current_user_info():
    """
    获取当前登录用户的信息
    """
    # TODO: Implement actual user info retrieval
    return {"message": "获取用户信息", "user": {"username": "test_user"}}